generating functions discrete math